"""
练习 7.1：汽⻋租赁 编写⼀个程序，询问⽤户要租什么样的汽⻋，并
打印⼀条消息，如下所⽰。
Let me see if I can find you a Subaru.

message = input('Which kind of car do you need? \n')
print(f'Let me see if I can find you a {message}.')
"""


"""
练习 7.2：餐馆订位 编写⼀个程序，询问⽤户有多少⼈⽤餐。如果超
过 8 个⼈，就打印⼀条消息，指出没有空桌；否则指出有空桌。

people_number = input('How many people will come for dinner? \n')
people_number = int(people_number)
if people_number > 8 :
    print('We have no free desk , i am so sorry!')
else:
    print('It is ok , we have place!')
"""

"""
练习 7.3：10 的整数倍 让⽤户输⼊⼀个数，并指出这个数是否是 10
的整数倍。

number = input('Please enter a number: ')
number = int(number)
if number%10 == 0 :
    print(f'The {number} is an integer multiple of ten.')
else:
    print(f'The {number} is NOT an integer multiple of ten.')
"""


"""
练习 7.4：⽐萨配料 编写⼀个循环，提⽰⽤户输⼊⼀系列⽐萨配料，
并在⽤户输⼊ 'quit' 时结束循环。每当⽤户输⼊⼀种配料后，都打
印⼀条消息，指出要在⽐萨中添加这种配料。

prompt = "\nTell me what you want to put on pizza."
prompt += "\nEnter 'quit' to end the program."
toppings = '0'
while toppings :
    toppings = input(prompt)
    if toppings!= 'quit':
       print(f'Please put {toppings} on pizza!')
    else:
        break
"""


"""
练习 7.6：三种出路 以不同的⽅式完成练习 7.4 或练习 7.5，在程序中
采取如下做法。
在 while 循环中使⽤条件测试来结束循环。
使⽤变量 active 来控制循环结束的时机。
使⽤ break 语句在⽤户输⼊ 'quit' 时退出循环。
一：
prompt = "\nTell me what you want to put on pizza."
prompt += "\nEnter 'quit' to end the program."
toppings = ''
while toppings !='quit' :
    toppings = input(prompt)
    if toppings!= 'quit':
       print(f'Please put {toppings} on pizza!')

二：
prompt = "\nTell me what you want to put on pizza."
prompt += "\nEnter 'quit' to end the program."
toppings = ''
active = True
while active :
    toppings = input(prompt)
    if toppings == 'quit':
       active = False
    else:
       print(f'Please put {toppings} on pizza!')

三：
prompt = "\nTell me what you want to put on pizza."
prompt += "\nEnter 'quit' to end the program."
toppings = '0'
while toppings :
    toppings = input(prompt)
    if toppings!= 'quit':
       print(f'Please put {toppings} on pizza!')
    else:
        break
"""


"""
练习 7.7：⽆限循环 编写⼀个没完没了的循环，并运⾏它。（要结束
该循环，可按 Ctrl + C，也可关闭显⽰输出的窗⼝。）
toppings = ''
while toppings !=quit:
    print(1)
"""


"""
练习 7.8：熟⾷店 创建⼀个名为 sandwich_orders 的列表，其中
包含各种三明治的名字，再创建⼀个名为 finished_sandwiches
的空列表。遍历列表 sandwich_orders，对于其中的每种三明治，
都打印⼀条消息，如“I made your tuna sandwich.”，并将其移到列表
finished_sandwiches 中。当所有三明治都制作好后，打印⼀条消
息，将这些三明治列出来。

sandwich_orders = ['chicken_sandwich','beef_sandwich','fishi_sandwich']
finished_sandwiches = []
while sandwich_orders:
    finished_sandwich = sandwich_orders.pop()
    print(f'I made your {finished_sandwich.title()} sandwich.')
    finished_sandwiches.append(finished_sandwich)
print('\nHere are all finished_sandwiches:')
print(finished_sandwiches)
"""


"""
练习 7.9：五⾹烟熏⽜⾁卖完了 使⽤为练习 7.8 创建的列表
sandwich_orders，并确保 'pastrami' 在其中⾄少出现了三次。
在程序开头附近添加这样的代码：先打印⼀条消息，指出熟⾷店的五
⾹烟熏⽜⾁（pastrami）卖完了；再使⽤⼀个 while 循环将列表
sandwich_orders 中的 'pastrami' 都删除。确认最终的列表
finished_sandwiches 中未包含 'pastrami'。

sandwich_orders = ['pastrami','chicken_sandwich','beef_sandwich','pastrami','fishi_sandwich','pastrami']
finished_sandwiches = []
while 'pastrami' in sandwich_orders:
    sandwich_orders.remove('pastrami')
print(sandwich_orders)
while sandwich_orders:
    finished_sandwich = sandwich_orders.pop()
    print(f'\nI made your {finished_sandwich.title()} sandwich.')
    finished_sandwiches.append(finished_sandwich)
print('\nHere are all finished_sandwiches:')
print(finished_sandwiches)
"""


"""
练习 7.10：梦想中的度假胜地 编写⼀个程序，调查⽤户梦想中的度
假胜地。使⽤类似于“If you could visit one place in the world, where
would you go?”的提⽰，并编写⼀个打印调查结果的代码块。

dream_places = []
dream_place = ''
while dream_place != 'quit' :
    dream_place = input('If you could visit one place in the world, where would you go?')
    if dream_place != 'quit':
        dream_places.append(dream_place)
    else:
        break
print(f'Here are consideration in research:\n {dream_places}')
"""
